package 连接数据库;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class hah {
    @Test
    @DisplayName("测试数据库连接")
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.cj.jdbc.Driver");//5.7加如cj

        Connection connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","1234");
        System.out.println(connection);


    }

}
